<?php $website_url = Configure::read('Website.url'); ?>

<div class="cat_page">
    <?php
    ?>
    <div class="cat_page_left"> <?php echo $this->element('product_specifications'); ?> </div>
    <div class="cat_page_right">

        <?php
        ?>
        <div class="paging_gray">
            <p>Showing 1 -
                <?php if (isset($products) and ($products)) {
                    echo count($products);
                } else {
                    echo "0";
                } ?>
                of
<?php if (isset($total_products) and ($total_products)) {
    echo $total_products;
} else {
    echo "0";
} ?>
                Results</p>
            <span class="f_right">
                <select onchange="this.form.submit();" id="sort" name="sort" class="sortByDropdown">
                    <option value="popular-srp-rank">Most Popular</option>
                    <option value="price">Price: Low to High</option>
                    <option value="-price">Price: High to Low</option>
                    <option value="reviewrank_authority">Avg. Customer Review</option>
                </select>
            </span> 
        </div>
        <div class="item_list_show">
            <h2><?php
if (isset($title) and ($title)) {
    echo $title;
} else {
    echo "Latest Products";
}
?></h2>
            <div class='common_border1'></div>
            <div class="def_div f_left">
                <?php
                if (isset($products) and ($products)) {
                    $x = 1;
                    foreach ($products as $product) {
                        ?>
                        <div class="item_list_B">
                            <ul>
                                <li>
                                    <p><?php echo $x; ?>.</p>
                                </li>
                                <li> <?php
                            echo $html->link($html->image('Product/' . $product['Product']['img'], array(
                                        'width' => '180',
                                        'height' => '180')
                                    ), array(
                                'controller' => 'products',
                                'action' => 'product',
                                $product['Product']['slug']
                                    ), array(
                                'escape' => false
                                    )
                            );
                            ?>
                                </li>
                                <li><span><?php echo $html->link($product['Product']['name'], array('controller' => 'products', 'action' => 'product', $product['Product']['slug']), array('escape' => false)); ?></span></li>
                                <li>
                                    <p>


        <?php echo $html->link($product['Product']['condition']['name'], array('controller' => 'products', 'action' => 'offer_listing', $product['Product']['wisn'], $product['Product']['condition']['slug']), array('escape' => false)); ?>


                                        <span class="over_line">$<?php echo $product['Product']['msrp']; ?></span> 
                                        <span class="red">$ <?php echo $product['Product']['MasterProduct']['price']; ?></span></p>
                                </li>
                                <?php
                                $date = mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"));
                                ?>
                                <li>
                                    <p>Get it by <b><?php echo date("D M d", $date); ?></b> if you order in the <b>next 16 hours</b> and choose one-day shipping.</p>
                                </li>
                                <li>
                                    <p><?php echo $product['Product']['stock_detail']; ?>....</p>
                                </li>
                                <li>
                                    <div class="rating_<?php echo $product['Product']['rating']; ?> f_left">&nbsp;</div>
                                    <p>&nbsp;<?php __get_pr_reviews($product['Product']['id']); ?></p>
                                </li>
                            </ul>
                        </div>
                        <?php
                        if ($x % 3 == 0) {
                            echo "<div class='clear'></div><div class='common_border1'></div>";
                        }
                        $x++;
                    }
                    ?>
                    <div class="paging_gray" style="line-height: 35px;"> <?php echo $this->element('paging'); ?> <span class="f_right"> </span> </div>

                    <?php
                }
                ?>
            </div>
        </div>
    </div>
</div>
